<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>第一联</title>
</head>
<body>

	<div id="contentIdOneBom" style="width: 900px;height:660px;margin: 5px auto" >
		<table id="oneBom_table" style="width: 853px;border: 1px">
		</table>
	</div>

	<script th:inline="none" type="text/javascript">

	var y=1;//没有此变量会死循环(不是循环访问加载后台数据)
	$(function () {
		var codeValue=threeBOMSearchInputCode.textbox("getText");
		var pkOrgValue=threeBOMSearchInputPkOrg.combobox('getValue');
		var oneBomTable=$("#oneBom_table").datagrid({
			//pagination:true,
           // pageList:[30],
			//pagePosition:'top',
			nowrap : false,
			//fitColumns:true,
			url:'/reportForms/selectOneForm?pkOrg='+pkOrgValue+'&code='+codeValue,
			onLoadSuccess:function(data){ //放到此事件中解决第一次不显示表头内容，但会死循环
				if (y==1){
					y++;
					var currentdate=getCurrentDate();
					var proCode=data.rows[0].proCode;
					var proName=data.rows[0].proName;
					var isProduce=data.rows[0].isProduce;
					var formulaNo=data.rows[0].formulaNo;
					var hversion=data.rows[0].hversion;

					oneBomTable.datagrid({
						columns:[
							[
								{ field:'a',title:'Opal Cosmetics(Huizhou) Limited Formulation',colspan:8,align:'center'},
							],

							[
								{ field:'proCode1',title:'物料编码',width:100, align:'center'},
								{ field:'proCode1',title:proCode,align:'center',colspan:5},
								{ field:'d',title:'打印日期：',align:'center',width:100},
								{ field:'e',title:currentdate,align:'center',colspan:2,width:200},
							],
							[
								{ field:'f',title:'物料名称',align:'center',width:100},
								{ field:'g',title:proName,align:'center',colspan:8},
							],
							[
								{ field:'h',title:'是否可生产:',align:'center',width:100},
								{ field:'i',title:isProduce,align:'center',width:100},
								{ field:'j',title:'BOM版本号:',align:'center',width:100},
								{ field:'k',title:hversion,align:'center',colspan:3},
								{ field:'l',title:'配方号:',align:'center',colspan:1},
								{ field:'m',title:formulaNo,align:'center'},
							],
							[
								{ field:'rowno',title:'行号',align:'center',width:100},
								{ field:'xbName',title:'相别',align:'center',width:50},
								{ field:'materialCode',title:'物料编码',align:'center',width:100},
								{ field:'materialName',title:'物料名称',align:'center',width:200},
								{ field:'measdocName',title:'单位',align:'center',width:100},
								{ field:'standardDosage',title:'标准用量',align:'center',width:100},
								{ field:'dividend',title:'底数',align:'center',width:100},
								{ field:'vnote',title:'备注',align:'center',width:100,}
							],
						],toolbar: [{
							text:'打印',
							iconCls: 'icon-print',
							handler: function(){
								printBom('contentIdOneBom');
							}

						}]

					})
				}
			},
		});
	});
</script>
</body>
</html>